/**
 author: chengzheng
 date: 2017/12/26
 email: 13120207061@163.com
 */
const uuid = require("uuid/v4");

/**
 * a task means that need to download
 * contains the whole message about it
 */
class Task {

    constructor(options) {
        this.id = uuid();
        //type of this task eg:browser,plain
        this.spiderType = options.spiderType || "plain";


        //post or get
        this.method = options.method || "get";

        //request url
        this.url = options.url;

        //proxy options
        if (!!options.proxy) {
            this.proxy = options.proxy;
        }

        //request headers
        this.headers = options.headers;

        this.createTime = new Date().getTime();
        if (!!options.referInfo) {
            this.referInfo = options.referInfo;
        }
    }

}

module.exports = Task;